package com.ittest.config;

import com.ittest.quartz.MyQuartz;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {


    @Bean
    public JobDetail printJobDetail(){
        //工作明细 需要绑定具体的工作
        return JobBuilder
                .newJob(MyQuartz.class)
                .storeDurably()
                .withIdentity("ccc")
                .build();
    }

    @Bean
    public Trigger printJobTrigger(){
        //需要绑定具体的工作明细
        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0/5 * * * * ?");
        return TriggerBuilder.newTrigger().forJob("ccc").withSchedule(schedBuilder).build();
    }




}
